package trading.algo;

import java.util.TimerTask;

import trading.bo.DBAccessorBO;
import trading.bo.IBAccessorBO;

/**
 * Stock and Option open orders
 * 
 * @author ntantai
 *
 */
public class OpenOrdersTask extends TimerTask {

	private IBAccessorBO ibAccessorBO;
	private DBAccessorBO dbAccessorBO;
	
	public OpenOrdersTask(IBAccessorBO ibAccessorBO, DBAccessorBO dbAccessorBO) {
		this.ibAccessorBO = ibAccessorBO;
		this.dbAccessorBO = dbAccessorBO;
	}
	
	@Override
	public void run() {
		dbAccessorBO.cleanUpOpenOrdersTable();
		ibAccessorBO.reqAllOpenOrders();
	}
	
	public static int secondsNeeded() {
	    return 1;
	}

}
